c=0
a=input()
if len(a)==2:
    for i in range(0,2):
        if a[i]=="(" and a[i+1]==")":
            c=c+1
        elif a[i]=="{" and a[i+1]=="}":
            c=c+1
        elif a[i]=="[" and a[i+1]=="]":
            c=c+1
        elif a[i]=="<" and a[i+1]==">":
            c=c+1
        if c==1:
            print("True")
            break
        else:
            print("False")
elif len(a)==4:
    for i in range(0,4):
        if a[i]=="(" and a[i+1]==")":
            c=c+1
        elif a[i]=="{" and a[i+1]=="}":
            c=c+1
        elif a[i]=="[" and a[i+1]=="]":
            c=c+1
        elif a[i]=="<" and a[i+1]==">":
            c=c+1
    if c==2:
        print("True")
    else:
        print("False")
elif len(a)==6:
    for i in range(0,3):
        if a[i]=="(" and a[i+1]==")" or a[i+3]==")":
            c=c+1
        elif a[i]=="{" and a[i+1]=="}" or a[i+3]=="}":
            c=c+1
        elif a[i]=="[" and a[i+1]=="]" or a[i+3]=="]" :
            c=c+1
        elif a[i]=="<" and a[i+1]==">" or a[i+3 ]==">" :
            c=c+1
    if c==3:
        print("True")
    else:
        print("False")
else:
    print("False")
